
const async1 = async () => {
    console.log('async1'); //2
    setTimeout(() => {
        console.log('timer1') //7
    }, 2000)
    await new Promise(resolve => {
        console.log('promise1') //3
    })
    console.log('async1 end') //? 前面Promise一直pending 所以这句一直被阻塞
    return 'async1 success'
}
console.log('script start');// 1
async1().then(res => console.log(res)); //? 没有resolve 这段执行不到
console.log('script end');//4
Promise.resolve(1)
    .then(2)
    .then(Promise.resolve(3))
    .catch(4)
    .then(res => console.log(res))//? 5 输出1 这里涉及到状态延续(then里不写函数则延续值)
setTimeout(() => {
    console.log('timer2') //? 6 定时器在时间完成后才加入宏队列 所以这个快一些
}, 1000)
